//
//  Created by Rene Dohan on 11/25/11.
//


#import "MerchantTransactionsController.h"
#import "Lang.h"
#import "LoadRowRequest.h"


@implementation MerchantTransactionsController

- (void)resetCell:(UITableViewCell *)cell {
    UILabel *affiliate = (UILabel *) [cell viewWithTag:1];
    affiliate.text = @"";
    UILabel *campaign = (UILabel *) [cell viewWithTag:2];
    campaign.text = @"";
    UILabel *commission = (UILabel *) [cell viewWithTag:3];
    commission.text = @"";
    UILabel *created = (UILabel *) [cell viewWithTag:4];
    created.text = @"";
    UILabel *orderId = (UILabel *) [cell viewWithTag:5];
    orderId.text = @"";
    UILabel *productId = (UILabel *) [cell viewWithTag:6];
    productId.text = @"";
    UIImageView *status = (UIImageView *) [cell viewWithTag:7];
    status.image = nil;
}

- (void)onRowDataReady:(NSDictionary *)rowData :(LoadRowRequest *)request {
    UILabel *affiliate = (UILabel *) [request.cell viewWithTag:1];
    affiliate.text = [Lang asString:[rowData valueForKey:@"affiliate_name"]];
    UILabel *campaign = (UILabel *) [request.cell viewWithTag:2];
    campaign.text = [Lang asString:[rowData valueForKey:@"campaign_name"]];
    UILabel *commission = (UILabel *) [request.cell viewWithTag:3];
    commission.text = [Lang asString:[rowData valueForKey:@"commision"]];
    UILabel *created = (UILabel *) [request.cell viewWithTag:4];
    created.text = [Lang asString:[rowData valueForKey:@"created"]];
    UILabel *orderId = (UILabel *) [request.cell viewWithTag:5];
    orderId.text = [Lang asString:[rowData valueForKey:@"order_id"]];
    UILabel *productId = (UILabel *) [request.cell viewWithTag:6];
    productId.text = [Lang asString:[rowData valueForKey:@"product_id"]];
    UIImageView *status = (UIImageView *) [request.cell viewWithTag:7];
    UIImage *statusImage = [self createStatusImage:[Lang asString:[rowData valueForKey:@"status"]]];
    status.image = statusImage;
}

@end